package org.zcl.枚举switch;

/**
 * @PROJECT_NAME:
 * @DESCRIPTION: switch语句后的控制表达式只能是short、char、int、long整数类型和枚举类型，不能是float，double和boolean类型。String类型是java7开始支持。
 * @USER: ZhuChengLin
 * @DATE: 2021/11/19 18:00
 */
public class SwitchEnumDemo {
    public static void main(String[] args) {
        Sex sex = new Sex();
        sex.setType(1);
        switch (SexType.getByType(sex.getType())) {
            case MAN:
                System.out.println(SexType.MAN.getWork());
                break;
            case GIRL:
                System.out.println(SexType.GIRL.getWork());
                break;
            default:
                System.out.println("未知");
                break;
        }
    }
}
